<%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8" %>
<%@ page import="java.util.*" %>
<%@ page import="com.sms.project.*" %>
<%@ page import="net.sf.json.*"%>

<%--
	project/student/query-project.jsp
 --%>

<%	//清除内存
	response.setHeader("Pragma","No-cache"); 
	response.setHeader("Cache-Control","no-cache"); 
	response.setDateHeader("Expires", 0); 
%>

<%
	request.setCharacterEncoding("utf-8");
	String userno = (String)session.getAttribute("userno");
	String role = (String)session.getAttribute("role");
	
	String progress = request.getParameter("progress");
	String condition = "";
	if(progress != null) {
		if(progress.trim().equals("already")) {
			condition = "finish";
		} else if(progress.trim().equals("unalready")){
			condition = "notfinish";
		} else {
			condition = "";
		}
	} else {
		condition = "";
	}
	
	List<Project> llist = new ArrayList<Project>();//leader
	llist = Task.getLProject(userno, condition, "headman");

	JSONArray json = new JSONArray();
	if(llist != null) {
  		for(int i=0; i<llist.size(); i++) {
  			Project p = llist.get(i);
  			JSONObject j = new JSONObject();
  			j.put("code", p.getProID());
  			j.put("name", p.getProName());
  			j.put("status", ((p.getStatus().equals("1")?"完成":"未完成")));
  			j.put("prodetail", "查看详情");
  			j.put("repdetail", "任务/信息交流");
  			json.add(j);
		}
	}
	//System.out.println(json.toString());
	out.println(json);
%>